package patrol.mobile.com.mobilepatrol.activity.security.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyDrill2Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyDrill3Activity;
import patrol.mobile.com.mobilepatrol.bean.Drill1Bean;

/**
 * Created by K on 2018/9/11.
 * des:
 */
public class EmergencyDrill1ListAdapter extends BaseQuickAdapter<Drill1Bean> {
    public EmergencyDrill1ListAdapter(Context context) {
        super(context);
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_emergency_drill1_list;
    }

    @Override
    protected void convert(BaseViewHolder holder, final Drill1Bean item) {
        holder.setText(R.id.tv_num, (holder.getLayoutPosition() + 1) + "");
        holder.setText(R.id.tv_indexName, item.getIndexName());
        holder.setText(R.id.tv_indexDate, item.getIndexDate());
        holder.setText(R.id.tv_ylNum, " 演练详情\n" +item.getYlNum()+"次" );


        holder.getView(R.id.tv_ylNum).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, EmergencyDrill3Activity.class);
                intent.putExtra("id", item.getId());
                mContext.startActivity(intent);
            }
        });


        holder.getView(R.id.rl_root).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, EmergencyDrill2Activity.class);
                intent.putExtra("id", item.getId());
                mContext.startActivity(intent);
            }
        });
    }
}
